<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <script src="./assets/d3-4.13.0.min.js"></script>
  <script src="./assets/jquery-3.2.1.min.js"></script>
  <script src="../build/g6.js"></script>
  <script src="../build/plugins.js"></script>
  <title>测试</title>
</head>

<body>
  <div id="mountNode"></div>
  <div id="minimap"></div>

  <style>
    /* 此处书写样式代码，支持 less scss */
    /* @import 'antd/dist/antd.css'; */
    .card-container {
      width: 170px;
      height: 74px;
      border: 1px solid #DBDBDB;
      border-radius: 4px;
      position: relative;
    }
    .card-container .main-text{
      text-align: center;
      margin: 12px 14px;
      padding-bottom: 8px;
      margin-bottom: 0px;
      font-size: 16px;
      border-bottom: 1px solid #DBDBDB;
    }
    .card-container p{
      font-size: 12px;
      margin: 8px;
    }
    .card-container .value-text{
      margin-left: 12px;
      text-align: left;
    }
    .card-container .percent-text{
      margin-right: 12px;
      float: right;
      color: red
    }
  </style>
  <script>
    G6.Global.updateDuration = 3000;
    const data = {
      nodes: [{
        id: 'node1',
        x: 100,
        y: 200
      }, {
        id: 'node2',
        x: 200,
        y: 200
      }],
      edges: [{
        target: 'node2',
        source: 'node1'
      }]
    };
    const graph = new G6.Graph({
      container: 'mountNode',
      height: window.innerHeight, // 画布高
      animate: true
    });
    graph.node({
      size: 16
    });
    graph.read(data);
    setTimeout(()=>{
      graph.update('node2', {
        x: 300
      })
    }, 1000);
    setTimeout(()=>{
      graph.preventAnimate(()=>{
        graph.update('node2', {
          x: 300
        })
      });
      graph.update('node2', {
        x: 400
      })
    }, 2000);
    setTimeout(()=>{
      graph.preventAnimate(()=>{
        graph.update('node2', {
          x: 400
        })
      });
      graph.update('node2', {
        x: 500
      })
    }, 3000);
  </script>
</body>
</html>

